﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Function_TopNews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MysqlHelp MHNews = new MysqlHelp();
        DataTable DTNews = new DataTable();
        string strSQL;
        string strAddres;
        string strId;
        string strTitle;
        string strOutPut;
        strSQL = "SELECT * FROM news WHERE isTop=1 AND enable=1 ORDER BY publishtime DESC LIMIT 3";
        DTNews = MHNews.GetDatabysql(strSQL);
        int RowCount = DTNews.Rows.Count;
        while (RowCount-->0)
        {
            strAddres = "NewsContent.aspx";
            strId = DTNews.Rows[RowCount]["id"].ToString();
            strTitle = DTNews.Rows[RowCount]["title"].ToString();
            strOutPut = string.Format("<a href='{0}?newsid={1}' target='_self'>{2}</a><br>", strAddres,strId,strTitle);
            Response.Write(strOutPut);
        }
    }
}
